<html>
<head>
<title>PHPMailer - SMTP advanced test with authentication</title>
</head>
<body>

<?php

require_once('PHPMailer_5.2.4/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
	function main()
	{
		$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

		$mail->IsSMTP(); // telling the class to use SMTP

		try {
		  $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
		  $mail->SMTPAuth   = true;                  // enable SMTP authentication
		  $mail->Host       = "students.pcci.edu"; // sets the SMTP server
		  $mail->Port       = 25;                    // set the SMTP port for the GMAIL server
		  $mail->Username   = "studentnet\116042"; // SMTP account username
		  $mail->Password   = "01263124";        // SMTP account password
		  $mail->AddAddress('Noctis.Skytower@gmail.com', 'Noctis Skytower');
		  $mail->SetFrom('schapp1161@students.pcci.edu', 'Stephen Chappell');
		  $mail->AddReplyTo('Stephen.P.Chappell@gmail.com', 'Stephen P. Chappell');
		  $mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
		  $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
		  $mail->MsgHTML(file_get_contents('PHPMailer_5.2.4/examples/contents.html'));
		  $mail->AddAttachment('PHPMailer_5.2.4/examples/images/phpmailer.gif');      // attachment
		  $mail->AddAttachment('PHPMailer_5.2.4/examples/images/phpmailer_mini.gif'); // attachment
		  $mail->Send();
		  echo "Message Sent OK</p>\n";
		} catch (phpmailerException $e) {
		  echo $e->errorMessage(); //Pretty error messages from PHPMailer
		} catch (Exception $e) {
		  echo $e->getMessage(); //Boring error messages from anything else!
		}
	}
	
if (!debug_backtrace())
{
	main();
}
?>

</body>
</html>
